#ifndef __cbtree_h
#define __cbtree_h

#include "slice.h"

//public api
typedef struct record {
	int	op;
	Slice	key;
	Slice	value;
	struct record*	next;
} Record;

typedef struct Btree *BtreeRef;


int btreeOpen(const char* path, BtreeRef* tree);

int btreeClose(BtreeRef tree);

int btreeBatchWrite(BtreeRef tree, const Record* batch);

int btreeSync(BtreeRef tree);

int btreeSingleOrMultiQuery(BtreeRef tree, Record* queryAndResult);

int btreePrefixOrRangeQuery(BtreeRef tree, const Record* query, Record* result);

int btreeStatBlocks(BtreeRef tree);

int btreeGetBlock(BtreeRef tree, int blockno, void** blockAddr);

#endif
